import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import {JVxeTypes,JVxeColumn} from '/@/components/jeecg/JVxeTable/types'
//列表数据
export const columns: BasicColumn[] = [
   {
    title: '客户名称',
    align:"center",
    dataIndex: 'customer'
   },
   {
    title: '设备识别码',
    align:"center",
    dataIndex: 'mcuNum'
   },
   {
    title: '设备型号',
    align:"center",
    dataIndex: 'printModel'
   },
   {
    title: '销售人员',
    align:"center",
    dataIndex: 'saleName'
   },
   {
    title: '销售类别',
    align:"center",
    dataIndex: 'saleType'
   },
   {
    title: '发货时间',
    align:"center",
    dataIndex: 'shipmentsTime',
    customRender:({text}) =>{
      text = !text ? "" : (text.length > 10 ? text.substr(0,10) : text);
      return text;
    },
   },
   {
    title: '销售单编号',
    align:"center",
    dataIndex: 'saleNum'
   },
   {
    title: '订单号',
    align:"center",
    dataIndex: 'orderNum'
   },
   {
    title: '预留1',
    align:"center",
    dataIndex: 'reserve1'
   },
   {
    title: '预留2',
    align:"center",
    dataIndex: 'reserve2'
   },
   {
    title: '预留3',
    align:"center",
    dataIndex: 'reserve3'
   },
   {
    title: '预留4',
    align:"center",
    dataIndex: 'reserve4'
   },
   {
    title: '数量',
    align:"center",
    dataIndex: 'reserve5'
   },
   {
    title: '下单日期',
    align:"center",
    dataIndex: 'orderTime'
   },
   {
    title: '订单状态',
    align:"center",
    dataIndex: 'status'
   },
   {
    title: '备注',
    align:"center",
    dataIndex: 'remark'
   },
   {
    title: '产品类型',
    align:"center",
    dataIndex: 'proType'
   },
   {
    title: '是否下发  0已下发  1未下发',
    align:"center",
    dataIndex: 'issue'
   },
   {
    title: '旧订单',
    align:"center",
    dataIndex: 'oldOrderNum'
   },
   {
    title: '日志',
    align:"center",
    dataIndex: 'log'
   },
   {
    title: '关联子订单数据',
    align:"center",
    dataIndex: 'proChildNum'
   },
   {
    title: '发货数量',
    align:"center",
    dataIndex: 'shipmentNum'
   },
];
//查询数据
export const searchFormSchema: FormSchema[] = [
];
//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '客户名称',
    field: 'customer',
    component: 'Input',
  },
  {
    label: '设备识别码',
    field: 'mcuNum',
    component: 'Input',
  },
  {
    label: '设备型号',
    field: 'printModel',
    component: 'Input',
  },
  {
    label: '销售人员',
    field: 'saleName',
    component: 'Input',
  },
  {
    label: '销售类别',
    field: 'saleType',
    component: 'Input',
  },
  {
    label: '发货时间',
    field: 'shipmentsTime',
    component: 'DatePicker',
    componentProps:{
      valueFormat: 'YYYY-MM-DD'
    },    
  },
  {
    label: '销售单编号',
    field: 'saleNum',
    component: 'Input',
  },
  {
    label: '订单号',
    field: 'orderNum',
    component: 'Input',
  },
  {
    label: '预留1',
    field: 'reserve1',
    component: 'Input',
  },
  {
    label: '预留2',
    field: 'reserve2',
    component: 'Input',
  },
  {
    label: '预留3',
    field: 'reserve3',
    component: 'Input',
  },
  {
    label: '预留4',
    field: 'reserve4',
    component: 'Input',
  },
  {
    label: '数量',
    field: 'reserve5',
    component: 'InputNumber',
  },
  {
    label: '下单日期',
    field: 'orderTime',
    component: 'DatePicker',
    componentProps: {
       showTime:true,
       valueFormat: 'YYYY-MM-DD HH:mm:ss'
     },
  },
  {
    label: '订单状态',
    field: 'status',
    component: 'Input',
  },
  {
    label: '备注',
    field: 'remark',
    component: 'Input',
  },
  {
    label: '产品类型',
    field: 'proType',
    component: 'Input',
  },
  {
    label: '是否下发  0已下发  1未下发',
    field: 'issue',
    component: 'Input',
  },
  {
    label: '旧订单',
    field: 'oldOrderNum',
    component: 'Input',
  },
  {
    label: '日志',
    field: 'log',
    component: 'Input',
  },
  {
    label: '关联子订单数据',
    field: 'proChildNum',
    component: 'InputNumber',
  },
  {
    label: '发货数量',
    field: 'shipmentNum',
    component: 'InputNumber',
  },
	// TODO 主键隐藏字段，目前写死为ID
	{
	  label: '',
	  field: 'id',
	  component: 'Input',
	  show: false
	},
];
//子表单数据
//子表表格配置
export const dwOrderProductColumns: JVxeColumn[] = [
    {
      title: '机型',
      key: 'proModel',
      type: JVxeTypes.input,
      width:"200px",
      placeholder: '请输入${title}',
      defaultValue:'',
    },
    {
      title: '恒温',
      key: 'isHeat',
      type: JVxeTypes.input,
      width:"200px",
      placeholder: '请输入${title}',
      defaultValue:'',
    },
    {
      title: '数量',
      key: 'num',
      type: JVxeTypes.inputNumber,
      width:"200px",
      placeholder: '请输入${title}',
      defaultValue:'',
    },
    {
      title: '描述',
      key: 'descc',
      type: JVxeTypes.input,
      width:"200px",
      placeholder: '请输入${title}',
      defaultValue:'',
    },
    {
      title: '订单外键ID',
      key: 'orderFkId',
      type: JVxeTypes.input,
      width:"200px",
      placeholder: '请输入${title}',
      defaultValue:'',
        validateRules: [
          { required: true, message: '${title}不能为空' },
        ],
    },
    {
      title: '产品电压',
      key: 'proVol',
      type: JVxeTypes.input,
      width:"200px",
      placeholder: '请输入${title}',
      defaultValue:'',
    },
    {
      title: '喷头',
      key: 'proHeat',
      type: JVxeTypes.input,
      width:"200px",
      placeholder: '请输入${title}',
      defaultValue:'',
    },
    {
      title: '喷头数量',
      key: 'proHeatNum',
      type: JVxeTypes.inputNumber,
      width:"200px",
      placeholder: '请输入${title}',
      defaultValue:'',
    },
  ]


// 高级查询数据
export const superQuerySchema = {
  customer: {title: '客户名称',order: 0,view: 'text', type: 'string',},
  mcuNum: {title: '设备识别码',order: 1,view: 'text', type: 'string',},
  printModel: {title: '设备型号',order: 2,view: 'text', type: 'string',},
  saleName: {title: '销售人员',order: 3,view: 'text', type: 'string',},
  saleType: {title: '销售类别',order: 4,view: 'text', type: 'string',},
  shipmentsTime: {title: '发货时间',order: 5,view: 'date', type: 'string',},
  saleNum: {title: '销售单编号',order: 6,view: 'text', type: 'string',},
  orderNum: {title: '订单号',order: 7,view: 'text', type: 'string',},
  reserve1: {title: '预留1',order: 8,view: 'text', type: 'string',},
  reserve2: {title: '预留2',order: 9,view: 'text', type: 'string',},
  reserve3: {title: '预留3',order: 10,view: 'text', type: 'string',},
  reserve4: {title: '预留4',order: 11,view: 'text', type: 'string',},
  reserve5: {title: '数量',order: 12,view: 'number', type: 'number',},
  orderTime: {title: '下单日期',order: 13,view: 'datetime', type: 'string',},
  status: {title: '订单状态',order: 14,view: 'text', type: 'string',},
  remark: {title: '备注',order: 15,view: 'text', type: 'string',},
  proType: {title: '产品类型',order: 16,view: 'text', type: 'string',},
  issue: {title: '是否下发  0已下发  1未下发',order: 17,view: 'text', type: 'string',},
  oldOrderNum: {title: '旧订单',order: 18,view: 'text', type: 'string',},
  log: {title: '日志',order: 19,view: 'text', type: 'string',},
  proChildNum: {title: '关联子订单数据',order: 20,view: 'number', type: 'number',},
  shipmentNum: {title: '发货数量',order: 21,view: 'number', type: 'number',},
  //子表高级查询
  dwOrderProduct: {
    title: '设备型号',
    view: 'table',
    fields: {
        proModel: {title: '机型',order: 0,view: 'text', type: 'string',},
        isHeat: {title: '恒温',order: 1,view: 'text', type: 'string',},
        num: {title: '数量',order: 2,view: 'number', type: 'number',},
        descc: {title: '描述',order: 3,view: 'text', type: 'string',},
        orderFkId: {title: '订单外键ID',order: 4,view: 'text', type: 'string',},
        proVol: {title: '产品电压',order: 5,view: 'text', type: 'string',},
        proHeat: {title: '喷头',order: 6,view: 'text', type: 'string',},
        proHeatNum: {title: '喷头数量',order: 7,view: 'number', type: 'number',},
    }
  },
};

/**
* 流程表单调用这个方法获取formSchema
* @param param
*/
export function getBpmFormSchema(_formData): FormSchema[]{
// 默认和原始表单保持一致 如果流程中配置了权限数据，这里需要单独处理formSchema
  return formSchema;
}
